package com.dhcc.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PropertiesUtil {

    private static Properties props;

    static {
        InputStream inputStream = null;
        try {
            props = new Properties();
            inputStream = PropertiesUtil.class.getClassLoader().getResourceAsStream("gateway.properties");
            props.load(inputStream);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if(inputStream != null) {
                try {
                    inputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public static String getVal(String key){
        return props.getProperty(key);
    }


    private PropertiesUtil() {
        throw new RuntimeException(this.getClass().getName() + " 不应该被创建实例");
    }
}